Repository navigation
Conversation
Collaborator
|
The first commit was merged as part of the original PR that proposed it. Can you explain what problem the second commit solves, and maybe even add a test? |
Contributor
Author
|
schemars defines transformations to apply to the schema, for eg. compatibility with OpenAPI. These transforms are defined in the schema settings. When aide accesses sub-schemas via |
|
Any news on version bump? |
Collaborator
|
No, sorry. |
Collaborator
|
@Diggsey sorry for the slow feedback. Could you rebase, and add a test for the transforms change? |
jplatte
pushed a commit
that referenced
this pull request
Sep 21, 2026
`schemars` only applies the transforms from its settings inside `root_schema_for` and `take_definitions(true)`. `aide` calls neither when building operations: it uses `subschema_for` and reads schemas back via `GenContext::resolve_schema`, so every schema `aide` inlines into the document was emitted untransformed and the generator settings were silently ignored. This is not limited to custom settings. `aide` defaults to `SchemaSettings::draft07`, which ships `ReplaceUnevaluatedProperties`, `RemoveRefSiblings` and `ReplacePrefixItems`, so a query struct with a tuple field emitted draft 2020-12 `prefixItems` into a draft 7 document. Add `GenContext::resolve_schema_transformed` and `GenContext::apply_transforms`, and use them wherever a resolved or inline schema is embedded directly: `parameters_from_schema` (which covers `Path`, `Query`, typed routing and `serde_qs`), the request body and response media types for `Json` and both `Form` extractors, and the header schema for `TypedHeader`. Schema references are deliberately left alone, since the definitions they point at are already transformed by `take_definitions(true)` when they are merged into the document. `TypedPath` needs care in the other direction: it reads its description out of `root_schema_for`, which has already run the transforms, so reusing that schema for the parameters would transform them twice. `Transform` carries no idempotency guarantee, so it now takes the parameters from `subschema_for` like every other caller of `parameters_from_schema`. Supersedes #230, which fixed `parameters_from_schema` but whose `operation_input_json` hunk transformed a clone that was only read for its description and then discarded, and which left the other five sites untouched. Co-authored-by: Diggory Blake <diggsey@googlemail.com>
Collaborator
|
Merged in #301. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.